package com.shanzmoo.core.domain.dto;

import com.shanzmoo.db.module.msys.entity.MSysUserEntity;
import com.shanzmoo.db.module.psys.entity.PSysUserEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotNull;

/**
 * 系统用户保存对象
 * @author: Gzhao 2020/11/12
 */
@Data
@ApiModel(value = "系统用户保存对象")
public class SysUserUpdateDTO extends SysUserSaveDTO{

    @NotNull(message = "用户Id不允许为空")
    @ApiModelProperty("用户id" )
    private Integer id;

    @Override
    public MSysUserEntity convertM() {
        MSysUserEntity userEntity = new MSysUserEntity();
        userEntity.setId(id);
        userEntity.setUsername(super.getUsername().trim());
        return userEntity;
    }

    @Override
    public PSysUserEntity convertP() {
        PSysUserEntity userEntity = new PSysUserEntity();
        userEntity.setId(id);
        userEntity.setUsername(super.getUsername().trim());
        return userEntity;
    }
}
